package com.jiamao.goplay.ui.discover.vm;

import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class CityMenuItemVM extends MultiItemViewModel {

    //用户名的绑定
    public ObservableField<String> title = new ObservableField<>("");
    public ObservableField<TextView> mTv = new ObservableField<>();

    public ObservableField<Boolean> select = new ObservableField<>();

    public CityMenuItemVM(@NonNull BaseViewModel viewModel,String name,boolean flag) {
        super(viewModel);
        title.set(name);
        select.set(flag);

    }




    //条目的点击事件
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {


            ((CityVM)viewModel).uc.pSwitchEvent.setValue(title.get());


        }


    });

    //ci
    public BindingCommand<TextView> mTextView =new BindingCommand<TextView>(textView -> {
        mTv.set(textView);
    });
}
